#!/bin/bash

echo $1 $2 $3 ' -> echo $essid $mode $ap'

echo ESSID: $1
echo MODE: $2
echo AP: $3

sudo service network-manager stop

sudo ifconfig wlan0 down
sudo dhclient -r wlan0
sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid $1 ap $3 mode $2
sudo dhclient wlan0

echo COMPLETE